@remarkablejames/editor 0.0.5 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (194) hide show
  1. package/README.md +1 -1
  2. package/lib/ActionMenuButton-D9o3Kwmv.cjs +1 -0
  3. package/lib/{ActionMenuButton-DBZjUu-F.js → ActionMenuButton-nxV91Fqo.js} +10 -9
  4. package/lib/Attachment.cjs +19 -1
  5. package/lib/Attachment.js +270 -7
  6. package/lib/Blockquote.cjs +2 -2
  7. package/lib/Blockquote.js +12 -13
  8. package/lib/Bold.cjs +1 -1
  9. package/lib/Bold.js +10 -11
  10. package/lib/BulletList.cjs +1 -1
  11. package/lib/BulletList.js +8 -9
  12. package/lib/Callout.cjs +1 -1
  13. package/lib/Callout.js +45 -41
  14. package/lib/Clear.cjs +1 -1
  15. package/lib/Clear.js +14 -13
  16. package/lib/Code.cjs +1 -1
  17. package/lib/Code.js +5 -6
  18. package/lib/CodeBlock.cjs +1 -1
  19. package/lib/CodeBlock.js +31 -30
  20. package/lib/CodeView.cjs +1 -1
  21. package/lib/CodeView.js +8 -9
  22. package/lib/Color.cjs +1 -1
  23. package/lib/Color.js +19 -18
  24. package/lib/Column.cjs +1 -1
  25. package/lib/Column.js +8 -9
  26. package/lib/Drawer-Bh-y5bs8.cjs +2 -0
  27. package/lib/{Drawer-DTCwtJEs.js → Drawer-CF6Z_IA2.js} +24 -18
  28. package/lib/Drawer.cjs +1 -1
  29. package/lib/Drawer.js +3 -3
  30. package/lib/Emoji.cjs +1 -1
  31. package/lib/Emoji.js +15 -14
  32. package/lib/Excalidraw.cjs +1 -1
  33. package/lib/Excalidraw.js +33 -28
  34. package/lib/ExportPdf.cjs +3 -3
  35. package/lib/ExportPdf.js +13 -14
  36. package/lib/ExportWord.cjs +1 -1
  37. package/lib/ExportWord.js +6 -6
  38. package/lib/FontFamily.cjs +1 -1
  39. package/lib/FontFamily.js +6 -7
  40. package/lib/FontSize.cjs +1 -1
  41. package/lib/FontSize.js +14 -15
  42. package/lib/Heading.cjs +1 -1
  43. package/lib/Heading.js +26 -26
  44. package/lib/Highlight.cjs +1 -1
  45. package/lib/Highlight.js +23 -22
  46. package/lib/History.cjs +1 -1
  47. package/lib/History.js +11 -11
  48. package/lib/HorizontalRule.cjs +1 -1
  49. package/lib/HorizontalRule.js +9 -10
  50. package/lib/Icon-BvGyfX2j.js +15 -0
  51. package/lib/Icon-wjwoRc9F.cjs +1 -0
  52. package/lib/Iframe-BbfZKbPY.cjs +1 -0
  53. package/lib/{Iframe-D-UYBxiv.js → Iframe-Dfd3LI7b.js} +18 -15
  54. package/lib/Iframe.cjs +1 -1
  55. package/lib/Iframe.js +3 -3
  56. package/lib/Image.cjs +1 -1
  57. package/lib/Image.js +5 -4
  58. package/lib/ImageCropper-CY1ETEjC.cjs +10 -0
  59. package/lib/ImageCropper-DrSdjo9x.js +979 -0
  60. package/lib/ImageGif.cjs +1 -1
  61. package/lib/ImageGif.js +80 -77
  62. package/lib/ImportWord.cjs +1 -1
  63. package/lib/ImportWord.js +28 -26
  64. package/lib/{Indent-Bvt-Qwar.js → Indent-CDVF9DWN.js} +30 -31
  65. package/lib/Indent-Q1VuhSM2.cjs +1 -0
  66. package/lib/Indent.cjs +1 -1
  67. package/lib/Indent.js +2 -2
  68. package/lib/Italic.cjs +1 -1
  69. package/lib/Italic.js +11 -12
  70. package/lib/{Katex-CJDtvu-v.js → Katex-DqhWWAA-.js} +22 -19
  71. package/lib/Katex-K1QU2SB2.cjs +4 -0
  72. package/lib/Katex.cjs +1 -1
  73. package/lib/Katex.js +2 -2
  74. package/lib/LineHeight.cjs +1 -1
  75. package/lib/LineHeight.js +20 -19
  76. package/lib/Link.cjs +1 -1
  77. package/lib/Link.js +2 -2
  78. package/lib/LinkEditBlock-CBYGLs3J.cjs +5 -0
  79. package/lib/{LinkEditBlock-Cdqwj_NU.js → LinkEditBlock-xP0pGVhB.js} +24 -19
  80. package/lib/Mention.js +3 -3
  81. package/lib/{Mermaid-CnMYVX1P.js → Mermaid-BJ6ryVdY.js} +48 -45
  82. package/lib/Mermaid-D3_nLeOW.cjs +2 -0
  83. package/lib/Mermaid.cjs +1 -1
  84. package/lib/Mermaid.js +2 -2
  85. package/lib/MoreMark.cjs +1 -1
  86. package/lib/MoreMark.js +28 -26
  87. package/lib/OrderedList.cjs +1 -1
  88. package/lib/OrderedList.js +10 -11
  89. package/lib/PaywallSeparator.cjs +1 -0
  90. package/lib/PaywallSeparator.js +140 -0
  91. package/lib/SearchAndReplace.cjs +1 -1
  92. package/lib/SearchAndReplace.js +42 -37
  93. package/lib/SlashCommand.cjs +1 -1
  94. package/lib/SlashCommand.js +5 -5
  95. package/lib/SlashCommandNodeView-CUJrDQS7.cjs +1 -0
  96. package/lib/{SlashCommandNodeView-DcoLvt_6.js → SlashCommandNodeView-DS9FqMiY.js} +80 -62
  97. package/lib/Strike.cjs +1 -1
  98. package/lib/Strike.js +11 -12
  99. package/lib/Table-CV6pUoVf.cjs +5 -0
  100. package/lib/{Table-Cu12PvQ_.js → Table-CcG-JNtV.js} +46 -46
  101. package/lib/Table.cjs +1 -1
  102. package/lib/Table.js +1 -1
  103. package/lib/TaskList.cjs +1 -1
  104. package/lib/TaskList.js +11 -12
  105. package/lib/TextAlign.cjs +1 -1
  106. package/lib/TextAlign.js +27 -26
  107. package/lib/TextDirection.cjs +1 -1
  108. package/lib/TextDirection.js +19 -18
  109. package/lib/TextUnderline.cjs +1 -1
  110. package/lib/TextUnderline.js +8 -9
  111. package/lib/{Twitter-CrX4XY1j.js → Twitter-BIL3o833.js} +22 -18
  112. package/lib/Twitter-BfSTqPDh.cjs +1 -0
  113. package/lib/Twitter.cjs +1 -1
  114. package/lib/Twitter.js +2 -2
  115. package/lib/Video-DAKr90QL.js +231 -0
  116. package/lib/Video-HAinT0w6.cjs +1 -0
  117. package/lib/Video.cjs +1 -1
  118. package/lib/Video.js +5 -4
  119. package/lib/bubble.cjs +3 -3
  120. package/lib/bubble.js +86 -77
  121. package/lib/button-090-I3tp.js +35 -0
  122. package/lib/button-B4Sz2ZhW.cjs +1 -0
  123. package/lib/checkbox-BCPsu7yR.cjs +1 -0
  124. package/lib/checkbox-DiXWHAI0.js +29 -0
  125. package/lib/{clsx-BUPZHhq3.js → clsx-m_C5j3RU.js} +24 -24
  126. package/lib/components/RichTextProvider.d.ts +1 -1
  127. package/lib/dialog-C8J59d2J.cjs +1 -0
  128. package/lib/dialog-bDkDW-C_.js +95 -0
  129. package/lib/dom-dataset-BqoJhJXt.cjs +1 -0
  130. package/lib/dom-dataset-CIEeltF6.js +47 -0
  131. package/lib/{dropdown-menu-CVwXaR3Z.js → dropdown-menu-DWt_xj4h.js} +1 -1
  132. package/lib/{dropdown-menu-XIrQk3jr.cjs → dropdown-menu-tUP872Zv.cjs} +1 -1
  133. package/lib/events.constant-Bke62qxm.cjs +1 -0
  134. package/lib/events.constant-CSWD3-ho.js +72 -0
  135. package/lib/extensions/PaywallSeparator/PaywallSeparator.d.ts +35 -0
  136. package/lib/extensions/PaywallSeparator/components/PaywallIcon.d.ts +2 -0
  137. package/lib/extensions/PaywallSeparator/components/PaywallSeparatorView.d.ts +17 -0
  138. package/lib/extensions/PaywallSeparator/components/RichTextPaywallSeparator.d.ts +1 -0
  139. package/lib/extensions/PaywallSeparator/components/index.d.ts +2 -0
  140. package/lib/extensions/PaywallSeparator/index.d.ts +1 -0
  141. package/lib/file-i7e4nQY2.cjs +1 -0
  142. package/lib/file-jDdkhyj7.js +43 -0
  143. package/lib/{index-RkKGy5oa.js → index-B3Ijnbxs.js} +1 -1
  144. package/lib/index-BXh8X1ch.cjs +1 -0
  145. package/lib/{index-Dl3OjzmR.js → index-C1KQsOcg.js} +1 -1
  146. package/lib/{index-D4M4hrH4.js → index-C8FjP66D.js} +1 -1
  147. package/lib/index-jMN4V2hr.js +2763 -0
  148. package/lib/{index-DZj2z9_1.js → index-s3l5RdyW.js} +1 -1
  149. package/lib/index.cjs +4 -4
  150. package/lib/index.js +464 -149
  151. package/lib/input-C_J-pfTx.js +21 -0
  152. package/lib/input-DwLo4r7V.cjs +1 -0
  153. package/lib/isNumber-BTYSVlKo.cjs +1 -0
  154. package/lib/isNumber-WaBzl_0s.js +15 -0
  155. package/lib/label-BgIVynq3.cjs +1 -0
  156. package/lib/label-ClsOg9Hr.js +11 -0
  157. package/lib/{popover-DDT8YRht.js → popover-BC7FRr8B.js} +1 -1
  158. package/lib/{popover-0syCfWYi.cjs → popover-C3A6zzNV.cjs} +1 -1
  159. package/lib/{renderNodeView-dj6AaFSX.js → renderNodeView-C_hPIdEs.js} +2 -2
  160. package/lib/{select-DTNz0ZeE.cjs → select-B8HIWDXf.cjs} +1 -1
  161. package/lib/{select-D9wQw2qB.js → select-DSKqhVGR.js} +1 -1
  162. package/lib/{separator-DRGTEiX4.js → separator-BJWSNjvr.js} +13 -12
  163. package/lib/separator-D6ruF682.cjs +1 -0
  164. package/lib/style.css +1 -1
  165. package/lib/tabs-D1J1iB7B.js +46 -0
  166. package/lib/tabs-IEbMQmNX.cjs +1 -0
  167. package/lib/{textarea-DfVzbMr5.js → textarea-Ch5w3PiI.js} +1 -1
  168. package/lib/{textarea-DpkwluT0.cjs → textarea-CtVdqwSM.cjs} +1 -1
  169. package/lib/theme.cjs +1 -1
  170. package/lib/theme.js +18 -18
  171. package/lib/throttle-CRNq0z-O.js +249 -0
  172. package/lib/throttle-gTTvqDTW.cjs +1 -0
  173. package/lib/toggle-C9tcMm1r.cjs +1 -0
  174. package/lib/toggle-CaSwYCk4.js +89 -0
  175. package/lib/types.d.ts +5 -5
  176. package/lib/{updatePosition-C294Pixi.js → updatePosition-DvfTZHcH.js} +2 -2
  177. package/lib/use-toast-C6zPo25l.cjs +1 -0
  178. package/lib/use-toast-CEOqhXfx.js +97 -0
  179. package/lib/useButtonProps-D-ruygH7.js +165 -0
  180. package/lib/useButtonProps-D9ndBdmA.cjs +1 -0
  181. package/package.json +34 -32
  182. package/lib/ActionMenuButton-C6jGtl3k.cjs +0 -1
  183. package/lib/Drawer-B031ezmA.cjs +0 -2
  184. package/lib/Iframe-BUK2pkOL.cjs +0 -1
  185. package/lib/Indent-_y6N8MIQ.cjs +0 -1
  186. package/lib/Katex-bJXkt-VP.cjs +0 -4
  187. package/lib/LinkEditBlock-ewTApx0K.cjs +0 -5
  188. package/lib/Mermaid-Dwz9o-yM.cjs +0 -2
  189. package/lib/SlashCommandNodeView-BMgQJ4xT.cjs +0 -1
  190. package/lib/Table-B8CHl8jK.cjs +0 -5
  191. package/lib/Twitter-6HYP_upt.cjs +0 -1
  192. package/lib/index-B0d-u29p.js +0 -5425
  193. package/lib/index-De9MZVWQ.cjs +0 -28
  194. package/lib/separator-D8lOAf8f.cjs +0 -1
package/README.md CHANGED
@@ -13,7 +13,7 @@
13
13
 
14
14
  ## Run Locally
15
15
 
16
- Clone the project
16
+ Clone the project:
17
17
 
18
18
  ```bash
19
19
  git clone https://github.com/hunghg255/reactjs-tiptap-editor.git
@@ -0,0 +1 @@
1
+ "use strict";const e=require("react/jsx-runtime"),a=require("@radix-ui/react-slot"),s=require("react"),i=require("./useButtonProps-D9ndBdmA.cjs"),d=require("./button-B4Sz2ZhW.cjs"),u=require("./index-BXh8X1ch.cjs"),m=s.forwardRef(({asChild:h=!1,tooltip:c,...t},l)=>{var x;const n=u.icons[t.icon],r=h?a.Slot:d.Button;return e.jsxs(i.Tooltip,{children:[e.jsx(i.TooltipTrigger,{asChild:!0,children:e.jsx(r,{className:"richtext-h-[32px] richtext-min-w-24 richtext-overflow-hidden richtext-px-[5px] richtext-py-0","data-state":t!=null&&t.dataState?"on":"off",disabled:t==null?void 0:t.disabled,ref:l,variant:"ghost",...t,children:e.jsxs("div",{className:"richtext-flex richtext-h-full richtext-items-center richtext-font-normal",children:[(t==null?void 0:t.title)&&e.jsx("div",{className:"richtext-grow richtext-truncate richtext-text-left richtext-text-sm",children:t==null?void 0:t.title}),n&&e.jsx(n,{className:"richtext-ml-1 richtext-size-3 richtext-shrink-0 richtext-text-zinc-500"})]})})}),c&&e.jsx(i.TooltipContent,{children:e.jsxs("div",{className:"richtext-flex richtext-max-w-24 richtext-flex-col richtext-items-center richtext-text-center",children:[c&&e.jsx("div",{children:c}),e.jsx("div",{className:"richtext-flex",children:!!((x=t==null?void 0:t.shortcutKeys)!=null&&x.length)&&e.jsx("span",{children:i.getShortcutKeys(t==null?void 0:t.shortcutKeys)})})]})})]})});exports.ActionMenuButton=m;
@@ -1,15 +1,16 @@
1
1
  import { jsxs as c, jsx as e } from "react/jsx-runtime";
2
2
  import { Slot as n } from "@radix-ui/react-slot";
3
3
  import r from "react";
4
- import { i as d, T as m, a as f, B as s, b as u, g } from "./index-B0d-u29p.js";
5
- import "./theme.js";
6
- const C = r.forwardRef(
4
+ import { T as m, a as d, b as f, g as s } from "./useButtonProps-D-ruygH7.js";
5
+ import { B as u } from "./button-090-I3tp.js";
6
+ import { i as o } from "./index-jMN4V2hr.js";
7
+ const b = r.forwardRef(
7
8
  ({ asChild: x = !1, tooltip: i, ...t }, l) => {
8
9
  var a;
9
- const h = d[t.icon];
10
+ const h = o[t.icon];
10
11
  return /* @__PURE__ */ c(m, { children: [
11
- /* @__PURE__ */ e(f, { asChild: !0, children: /* @__PURE__ */ e(
12
- x ? n : s,
12
+ /* @__PURE__ */ e(d, { asChild: !0, children: /* @__PURE__ */ e(
13
+ x ? n : u,
13
14
  {
14
15
  className: "richtext-h-[32px] richtext-min-w-24 richtext-overflow-hidden richtext-px-[5px] richtext-py-0",
15
16
  "data-state": t != null && t.dataState ? "on" : "off",
@@ -23,13 +24,13 @@ const C = r.forwardRef(
23
24
  ] })
24
25
  }
25
26
  ) }),
26
- i && /* @__PURE__ */ e(u, { children: /* @__PURE__ */ c("div", { className: "richtext-flex richtext-max-w-24 richtext-flex-col richtext-items-center richtext-text-center", children: [
27
+ i && /* @__PURE__ */ e(f, { children: /* @__PURE__ */ c("div", { className: "richtext-flex richtext-max-w-24 richtext-flex-col richtext-items-center richtext-text-center", children: [
27
28
  i && /* @__PURE__ */ e("div", { children: i }),
28
- /* @__PURE__ */ e("div", { className: "richtext-flex", children: !!((a = t == null ? void 0 : t.shortcutKeys) != null && a.length) && /* @__PURE__ */ e("span", { children: g(t == null ? void 0 : t.shortcutKeys) }) })
29
+ /* @__PURE__ */ e("div", { className: "richtext-flex", children: !!((a = t == null ? void 0 : t.shortcutKeys) != null && a.length) && /* @__PURE__ */ e("span", { children: s(t == null ? void 0 : t.shortcutKeys) }) })
29
30
  ] }) })
30
31
  ] });
31
32
  }
32
33
  );
33
34
  export {
34
- C as A
35
+ b as A
35
36
  };
@@ -1 +1,19 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./clsx-CXbNJWDD.cjs");const e=require("./index-De9MZVWQ.cjs");require("react/jsx-runtime");require("react");require("./theme.cjs");exports.Attachment=e.Attachment;exports.RichTextAttachment=e.RichTextAttachment;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./clsx-CXbNJWDD.cjs"),g=require("./toggle-C9tcMm1r.cjs"),A=require("./events.constant-Bke62qxm.cjs"),e=require("react/jsx-runtime"),p=require("lucide-react"),j=require("./index-BXh8X1ch.cjs"),f=require("./file-i7e4nQY2.cjs"),y=require("react"),L=require("./index-DgOXAdKt.cjs"),m=require("./dom-dataset-BqoJhJXt.cjs"),T=require("./useButtonProps-D9ndBdmA.cjs"),H={audio:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-audio-lines"><path d="M2 10v3"/><path d="M6 6v11"/><path d="M10 3v18"/><path d="M14 8v7"/><path d="M18 5v13"/><path d="M22 10v3"/></svg>',video:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-video"><path d="m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5"/><rect x="2" y="6" width="14" height="12" rx="2"/></svg>',file:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-file"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/></svg>',image:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-image"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>',pdf:`<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 32 32">
2
+ <path fill="currentColor" d="M30 18v-2h-6v10h2v-4h3v-2h-3v-2zm-11 8h-4V16h4a3.003 3.003 0 0 1 3 3v4a3.003 3.003 0 0 1-3 3m-2-2h2a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1h-2zm-6-8H6v10h2v-3h3a2.003 2.003 0 0 0 2-2v-3a2 2 0 0 0-2-2m-3 5v-3h3l.001 3z"></path>
3
+ <path fill="currentColor" d="M22 14v-4a.91.91 0 0 0-.3-.7l-7-7A.9.9 0 0 0 14 2H4a2.006 2.006 0 0 0-2 2v24a2 2 0 0 0 2 2h16v-2H4V4h8v6a2.006 2.006 0 0 0 2 2h6v2Zm-8-4V4.4l5.6 5.6Z"></path>
4
+ </svg>`,word:`<svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ width="1em"
7
+ height="1em"
8
+ className="icon"
9
+ viewBox="0 0 1024 1024"
10
+ >
11
+ <path
12
+ fill="currentColor"
13
+ d="M679.253 402.364 618.77 561.015l-60.348-158.651a30.04 30.04 0 0 0-30.447-18.637 29.76 29.76 0 0 0-30.447 18.637l-60.416 158.651-60.416-158.651a30.515 30.515 0 0 0-38.843-17.272 28.945 28.945 0 0 0-17.954 37.547l88.815 233.267c4.369 11.469 15.7 19.115 28.398 19.115a30.31 30.31 0 0 0 28.468-19.115l62.395-163.908 62.396 163.84c4.437 11.605 15.701 19.183 28.4 19.183a30.31 30.31 0 0 0 28.466-19.115l88.747-233.267a28.945 28.945 0 0 0-17.886-37.547 30.447 30.447 0 0 0-38.912 17.272zm219.478 395.605-51.883-29.218c-28.672-16.18-52.224-3.072-52.224 29.082v.273H643.209a29.833 29.833 0 0 0-30.31 29.354c0 16.18 13.584 29.218 30.31 29.218h151.825c1.092 30.516 24.03 43.077 52.224 27.648l51.063-27.989c29.013-15.906 29.15-42.189.41-58.368"
14
+ />
15
+ <path
16
+ fill="currentColor"
17
+ d="m810.667 913.135-.478.068H201.796c-19.865 0-36.727-11.673-36.727-25.6v-618.36h154.965c51.268 0 92.911-39.39 92.911-87.858v-87.86H810.19c19.797 0 36.522 11.742 36.522 25.669V739.26h61.987V119.262c0-46.421-44.169-84.241-98.51-84.241H328.364l-225.28 194.56v658.09c0 46.285 44.236 84.105 98.713 84.105H810.19c43.759 0 80.554-24.713 93.32-58.573h-92.842zM350.89 94.89v86.562c0 16.11-13.858 29.286-30.925 29.286H216.815L350.959 94.891z"
18
+ />
19
+ </svg>`,excel:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-sheet"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><line x1="3" x2="21" y1="9" y2="9"/><line x1="3" x2="21" y1="15" y2="15"/><line x1="9" x2="9" y1="9" y2="21"/><line x1="15" x2="15" y1="9" y2="21"/></svg>',ppt:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-table-properties"><path d="M15 3v18"/><rect width="18" height="18" x="3" y="3" rx="2"/><path d="M21 9H3"/><path d="M21 15H3"/></svg>'};function E(t){const i=H[t],l=new DOMParser().parseFromString(i,"image/svg+xml").documentElement,c=["svg",{...Array.from(l.attributes).reduce((r,s)=>(r[s.name]=s.value,r),{})}];return Array.from(l.childNodes).forEach(r=>{if(r.nodeType===1){const s=[r.tagName.toLowerCase(),Array.from(r.attributes).reduce((u,d)=>(u[d.name]=d.value,u),{})];r.textContent&&s.push(r.textContent),c.push(s)}}),c}const z={audio:e.jsx(p.LucideAudioLines,{}),video:e.jsx(p.LucideVideo,{}),file:e.jsx(p.LucideFile,{}),image:e.jsx(p.LucideImage,{}),pdf:e.jsx(j.ExportPdf,{}),word:e.jsx(j.ExportWord,{}),excel:e.jsx(p.LucideSheet,{}),ppt:e.jsx(p.LucideTableProperties,{})};function b(t,i=!1){const o=f.normalizeFileType(t),n=z[o]||e.jsx(e.Fragment,{});return i?E(o):n}const C="_card_1is0r_64",B="_downloadBtn_1is0r_82",D="_cardLeft_1is0r_88",S="_iconWrap_1is0r_97",V="_fileInfo_1is0r_116",P="_fileName_1is0r_123",q="_fileSize_1is0r_133",F="_cardPreview_1is0r_145",I="_actions_1is0r_221",R="_cardError_1is0r_236",W="_errorText_1is0r_240",a={card:C,downloadBtn:B,cardLeft:D,iconWrap:S,fileInfo:V,fileName:P,fileSize:q,cardPreview:F,actions:I,cardError:R,errorText:W};function O({editor:t,node:i,deleteNode:o,extension:n}){var _;const l=(t==null?void 0:t.isEditable)??!1,{fileName:c,fileSize:r,fileExt:s,fileType:u,id:d,error:w}=i.attrs,{t:x}=L.useLocale(),v=(_=n==null?void 0:n.options)==null?void 0:_.onDownload,M=y.useCallback(()=>o(),[o]),N=y.useCallback(()=>{!d||!v||v({id:d,fileName:c,fileExt:s,fileType:u,fileSize:r})},[d,c,s,u,r,v]);return w&&w!=="null"?e.jsx(h.NodeViewWrapper,{children:e.jsx("div",{className:h.clsx(a.card,a.cardError,"render-wrapper"),children:e.jsx("p",{className:a.errorText,children:w})})}):d?e.jsx(h.NodeViewWrapper,{children:e.jsxs("div",{className:h.clsx(a.card,"render-wrapper",{[a.cardPreview]:!l}),children:[e.jsxs("div",{className:a.cardLeft,children:[e.jsx("div",{className:a.iconWrap,children:b(u)}),e.jsxs("div",{className:a.fileInfo,children:[e.jsxs("span",{className:a.fileName,children:[c,".",s]}),e.jsx("span",{className:a.fileSize,children:f.normalizeFileSize(r)})]})]}),e.jsxs("div",{className:a.actions,children:[v&&e.jsx(g.ActionButton,{action:N,icon:"AttachmentDownload",tooltip:x("editor.attachment.download"),customClass:l?void 0:a.downloadBtn}),l&&e.jsx(g.ActionButton,{action:M,icon:"Trash2",tooltip:x("editor.delete")})]})]})}):e.jsx(e.Fragment,{})}function $(){const t=T.useButtonProps(k.name),{icon:i=void 0,tooltip:o=void 0,shortcutKeys:n=void 0,tooltipOptions:l={},action:c=void 0,isActive:r=void 0}=(t==null?void 0:t.componentProps)??{},{editorDisabled:s,update:u}=T.useToggleActive(r),d=()=>{s||c&&(c(),u())};return t?e.jsx(g.ActionButton,{action:d,disabled:s,icon:i,shortcutKeys:n,tooltip:o,tooltipOptions:l}):e.jsx(e.Fragment,{})}const k=h.Node3.create({name:"attachment",content:"",marks:"",group:"block",selectable:!0,atom:!0,draggable:!0,addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),HTMLAttributes:{class:"attachment"},button:({editor:i,t:o})=>({component:g.ActionButton,componentProps:{action:()=>{const n=A.EVENTS.UPLOAD_ATTACHMENT(i.id);A.emit(n,!0)},isActive:()=>!1,disabled:!1,icon:"Attachment",tooltip:o("editor.attachment.tooltip")}})}},parseHTML(){return[{tag:"div[class=attachment]"}]},renderHTML({HTMLAttributes:t}){const{id:i="",fileName:o="",fileSize:n="",fileType:l="",fileExt:c=""}=t||{};return["div",h.mergeAttributes(this.options.HTMLAttributes||{},t||{}),i?["span",{class:"attachment__body"},["span",{class:"attachment__icon"},b(l,!0)],["span",{class:"attachment__text"},`${o}.${c} (${f.normalizeFileSize(n)})`]]:["div",{class:"attachment__placeholder"}]]},addAttributes(){return{id:{default:null,parseHTML:m.getDatasetAttribute("id")},fileName:{default:null,parseHTML:m.getDatasetAttribute("filename")},fileSize:{default:null,parseHTML:m.getDatasetAttribute("filesize")},fileType:{default:null,parseHTML:m.getDatasetAttribute("filetype")},fileExt:{default:null,parseHTML:m.getDatasetAttribute("fileext")},error:{default:null,parseHTML:m.getDatasetAttribute("error")}}},addCommands(){return{setAttachment:t=>({chain:i})=>i().insertContent({type:this.name,attrs:t}).run()}},addNodeView(){return h.ReactNodeViewRenderer(O)}});exports.Attachment=k;exports.RichTextAttachment=$;
package/lib/Attachment.js CHANGED
@@ -1,9 +1,272 @@
1
- import "./clsx-BUPZHhq3.js";
2
- import { X as a, Y as e } from "./index-B0d-u29p.js";
3
- import "react/jsx-runtime";
4
- import "react";
5
- import "./theme.js";
1
+ import { h as _, j as y, N as L, k as E, m as H } from "./clsx-m_C5j3RU.js";
2
+ import { A as v } from "./toggle-CaSwYCk4.js";
3
+ import { E as b, e as C } from "./events.constant-CSWD3-ho.js";
4
+ import { jsx as t, Fragment as w, jsxs as u } from "react/jsx-runtime";
5
+ import { LucideTableProperties as z, LucideSheet as B, LucideImage as V, LucideFile as S, LucideVideo as D, LucideAudioLines as P } from "lucide-react";
6
+ import { E as j, b as I } from "./index-jMN4V2hr.js";
7
+ import { n as F, a as k } from "./file-jDdkhyj7.js";
8
+ import { useCallback as T } from "react";
9
+ import { u as W } from "./index-BGd2HiwP.js";
10
+ import { g as m } from "./dom-dataset-CIEeltF6.js";
11
+ import { u as O, c as R } from "./useButtonProps-D-ruygH7.js";
12
+ const Z = {
13
+ audio: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-audio-lines"><path d="M2 10v3"/><path d="M6 6v11"/><path d="M10 3v18"/><path d="M14 8v7"/><path d="M18 5v13"/><path d="M22 10v3"/></svg>',
14
+ video: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-video"><path d="m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5"/><rect x="2" y="6" width="14" height="12" rx="2"/></svg>',
15
+ file: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-file"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/></svg>',
16
+ image: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-image"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>',
17
+ pdf: `<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 32 32">
18
+ <path fill="currentColor" d="M30 18v-2h-6v10h2v-4h3v-2h-3v-2zm-11 8h-4V16h4a3.003 3.003 0 0 1 3 3v4a3.003 3.003 0 0 1-3 3m-2-2h2a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1h-2zm-6-8H6v10h2v-3h3a2.003 2.003 0 0 0 2-2v-3a2 2 0 0 0-2-2m-3 5v-3h3l.001 3z"></path>
19
+ <path fill="currentColor" d="M22 14v-4a.91.91 0 0 0-.3-.7l-7-7A.9.9 0 0 0 14 2H4a2.006 2.006 0 0 0-2 2v24a2 2 0 0 0 2 2h16v-2H4V4h8v6a2.006 2.006 0 0 0 2 2h6v2Zm-8-4V4.4l5.6 5.6Z"></path>
20
+ </svg>`,
21
+ word: `<svg
22
+ xmlns="http://www.w3.org/2000/svg"
23
+ width="1em"
24
+ height="1em"
25
+ className="icon"
26
+ viewBox="0 0 1024 1024"
27
+ >
28
+ <path
29
+ fill="currentColor"
30
+ d="M679.253 402.364 618.77 561.015l-60.348-158.651a30.04 30.04 0 0 0-30.447-18.637 29.76 29.76 0 0 0-30.447 18.637l-60.416 158.651-60.416-158.651a30.515 30.515 0 0 0-38.843-17.272 28.945 28.945 0 0 0-17.954 37.547l88.815 233.267c4.369 11.469 15.7 19.115 28.398 19.115a30.31 30.31 0 0 0 28.468-19.115l62.395-163.908 62.396 163.84c4.437 11.605 15.701 19.183 28.4 19.183a30.31 30.31 0 0 0 28.466-19.115l88.747-233.267a28.945 28.945 0 0 0-17.886-37.547 30.447 30.447 0 0 0-38.912 17.272zm219.478 395.605-51.883-29.218c-28.672-16.18-52.224-3.072-52.224 29.082v.273H643.209a29.833 29.833 0 0 0-30.31 29.354c0 16.18 13.584 29.218 30.31 29.218h151.825c1.092 30.516 24.03 43.077 52.224 27.648l51.063-27.989c29.013-15.906 29.15-42.189.41-58.368"
31
+ />
32
+ <path
33
+ fill="currentColor"
34
+ d="m810.667 913.135-.478.068H201.796c-19.865 0-36.727-11.673-36.727-25.6v-618.36h154.965c51.268 0 92.911-39.39 92.911-87.858v-87.86H810.19c19.797 0 36.522 11.742 36.522 25.669V739.26h61.987V119.262c0-46.421-44.169-84.241-98.51-84.241H328.364l-225.28 194.56v658.09c0 46.285 44.236 84.105 98.713 84.105H810.19c43.759 0 80.554-24.713 93.32-58.573h-92.842zM350.89 94.89v86.562c0 16.11-13.858 29.286-30.925 29.286H216.815L350.959 94.891z"
35
+ />
36
+ </svg>`,
37
+ excel: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-sheet"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><line x1="3" x2="21" y1="9" y2="9"/><line x1="3" x2="21" y1="15" y2="15"/><line x1="9" x2="9" y1="9" y2="21"/><line x1="15" x2="15" y1="9" y2="21"/></svg>',
38
+ ppt: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-table-properties"><path d="M15 3v18"/><rect width="18" height="18" x="3" y="3" rx="2"/><path d="M21 9H3"/><path d="M21 15H3"/></svg>'
39
+ };
40
+ function $(e) {
41
+ const o = Z[e], c = new DOMParser().parseFromString(o, "image/svg+xml").documentElement, l = [
42
+ "svg",
43
+ {
44
+ ...Array.from(c.attributes).reduce((r, a) => (r[a.name] = a.value, r), {})
45
+ }
46
+ ];
47
+ return Array.from(c.childNodes).forEach((r) => {
48
+ if (r.nodeType === 1) {
49
+ const a = [
50
+ r.tagName.toLowerCase(),
51
+ Array.from(r.attributes).reduce((h, d) => (h[d.name] = d.value, h), {})
52
+ ];
53
+ r.textContent && a.push(r.textContent), l.push(a);
54
+ }
55
+ }), l;
56
+ }
57
+ const K = {
58
+ audio: /* @__PURE__ */ t(P, {}),
59
+ video: /* @__PURE__ */ t(D, {}),
60
+ file: /* @__PURE__ */ t(S, {}),
61
+ image: /* @__PURE__ */ t(V, {}),
62
+ pdf: /* @__PURE__ */ t(I, {}),
63
+ word: /* @__PURE__ */ t(j, {}),
64
+ excel: /* @__PURE__ */ t(B, {}),
65
+ ppt: /* @__PURE__ */ t(z, {})
66
+ };
67
+ function A(e, o = !1) {
68
+ const i = F(e), n = K[i] || /* @__PURE__ */ t(w, {});
69
+ return o ? $(i) : n;
70
+ }
71
+ const U = "_card_1is0r_64", q = "_downloadBtn_1is0r_82", G = "_cardLeft_1is0r_88", J = "_iconWrap_1is0r_97", Q = "_fileInfo_1is0r_116", X = "_fileName_1is0r_123", Y = "_fileSize_1is0r_133", ee = "_cardPreview_1is0r_145", te = "_actions_1is0r_221", re = "_cardError_1is0r_236", oe = "_errorText_1is0r_240", s = {
72
+ card: U,
73
+ downloadBtn: q,
74
+ cardLeft: G,
75
+ iconWrap: J,
76
+ fileInfo: Q,
77
+ fileName: X,
78
+ fileSize: Y,
79
+ cardPreview: ee,
80
+ actions: te,
81
+ cardError: re,
82
+ errorText: oe
83
+ };
84
+ function ie({
85
+ editor: e,
86
+ node: o,
87
+ deleteNode: i,
88
+ extension: n
89
+ }) {
90
+ var x;
91
+ const c = (e == null ? void 0 : e.isEditable) ?? !1, { fileName: l, fileSize: r, fileExt: a, fileType: h, id: d, error: f } = o.attrs, { t: g } = W(), p = (x = n == null ? void 0 : n.options) == null ? void 0 : x.onDownload, M = T(() => i(), [i]), N = T(() => {
92
+ !d || !p || p({ id: d, fileName: l, fileExt: a, fileType: h, fileSize: r });
93
+ }, [d, l, a, h, r, p]);
94
+ return f && f !== "null" ? /* @__PURE__ */ t(_, { children: /* @__PURE__ */ t("div", { className: y(s.card, s.cardError, "render-wrapper"), children: /* @__PURE__ */ t("p", { className: s.errorText, children: f }) }) }) : d ? /* @__PURE__ */ t(_, { children: /* @__PURE__ */ u(
95
+ "div",
96
+ {
97
+ className: y(s.card, "render-wrapper", {
98
+ [s.cardPreview]: !c
99
+ }),
100
+ children: [
101
+ /* @__PURE__ */ u("div", { className: s.cardLeft, children: [
102
+ /* @__PURE__ */ t("div", { className: s.iconWrap, children: A(h) }),
103
+ /* @__PURE__ */ u("div", { className: s.fileInfo, children: [
104
+ /* @__PURE__ */ u("span", { className: s.fileName, children: [
105
+ l,
106
+ ".",
107
+ a
108
+ ] }),
109
+ /* @__PURE__ */ t("span", { className: s.fileSize, children: k(r) })
110
+ ] })
111
+ ] }),
112
+ /* @__PURE__ */ u("div", { className: s.actions, children: [
113
+ p && /* @__PURE__ */ t(
114
+ v,
115
+ {
116
+ action: N,
117
+ icon: "AttachmentDownload",
118
+ tooltip: g("editor.attachment.download"),
119
+ customClass: c ? void 0 : s.downloadBtn
120
+ }
121
+ ),
122
+ c && /* @__PURE__ */ t(
123
+ v,
124
+ {
125
+ action: M,
126
+ icon: "Trash2",
127
+ tooltip: g("editor.delete")
128
+ }
129
+ )
130
+ ] })
131
+ ]
132
+ }
133
+ ) }) : /* @__PURE__ */ t(w, {});
134
+ }
135
+ function we() {
136
+ const e = O(ne.name), {
137
+ icon: o = void 0,
138
+ tooltip: i = void 0,
139
+ shortcutKeys: n = void 0,
140
+ tooltipOptions: c = {},
141
+ action: l = void 0,
142
+ isActive: r = void 0
143
+ } = (e == null ? void 0 : e.componentProps) ?? {}, { editorDisabled: a, update: h } = R(r), d = () => {
144
+ a || l && (l(), h());
145
+ };
146
+ return e ? /* @__PURE__ */ t(
147
+ v,
148
+ {
149
+ action: d,
150
+ disabled: a,
151
+ icon: o,
152
+ shortcutKeys: n,
153
+ tooltip: i,
154
+ tooltipOptions: c
155
+ }
156
+ ) : /* @__PURE__ */ t(w, {});
157
+ }
158
+ const ne = /* @__PURE__ */ L.create({
159
+ name: "attachment",
160
+ content: "",
161
+ marks: "",
162
+ group: "block",
163
+ selectable: !0,
164
+ atom: !0,
165
+ draggable: !0,
166
+ //@ts-expect-error
167
+ addOptions() {
168
+ var e;
169
+ return {
170
+ ...(e = this.parent) == null ? void 0 : e.call(this),
171
+ HTMLAttributes: {
172
+ class: "attachment"
173
+ },
174
+ button: ({ editor: o, t: i }) => ({
175
+ component: v,
176
+ componentProps: {
177
+ /**
178
+ * Instead of immediately inserting an empty node, we emit an event
179
+ * that opens the attachment dialog. The node is only inserted once
180
+ * the upload callback has returned an id.
181
+ */
182
+ action: () => {
183
+ const n = b.UPLOAD_ATTACHMENT(o.id);
184
+ C(n, !0);
185
+ },
186
+ isActive: () => !1,
187
+ disabled: !1,
188
+ icon: "Attachment",
189
+ tooltip: i("editor.attachment.tooltip")
190
+ }
191
+ })
192
+ };
193
+ },
194
+ parseHTML() {
195
+ return [{ tag: "div[class=attachment]" }];
196
+ },
197
+ renderHTML({ HTMLAttributes: e }) {
198
+ const {
199
+ id: o = "",
200
+ fileName: i = "",
201
+ fileSize: n = "",
202
+ fileType: c = "",
203
+ fileExt: l = ""
204
+ } = e || {};
205
+ return [
206
+ "div",
207
+ H(
208
+ // @ts-expect-error
209
+ this.options.HTMLAttributes || {},
210
+ e || {}
211
+ ),
212
+ o ? [
213
+ "span",
214
+ { class: "attachment__body" },
215
+ [
216
+ "span",
217
+ { class: "attachment__icon" },
218
+ A(c, !0)
219
+ ],
220
+ [
221
+ "span",
222
+ { class: "attachment__text" },
223
+ `${i}.${l} (${k(n)})`
224
+ ]
225
+ ] : ["div", { class: "attachment__placeholder" }]
226
+ ];
227
+ },
228
+ addAttributes() {
229
+ return {
230
+ /**
231
+ * The UUID / primary key your backend assigned to this asset.
232
+ * This is the only persistent reference stored in the document.
233
+ */
234
+ id: {
235
+ default: null,
236
+ parseHTML: m("id")
237
+ },
238
+ fileName: {
239
+ default: null,
240
+ parseHTML: m("filename")
241
+ },
242
+ fileSize: {
243
+ default: null,
244
+ parseHTML: m("filesize")
245
+ },
246
+ fileType: {
247
+ default: null,
248
+ parseHTML: m("filetype")
249
+ },
250
+ fileExt: {
251
+ default: null,
252
+ parseHTML: m("fileext")
253
+ },
254
+ error: {
255
+ default: null,
256
+ parseHTML: m("error")
257
+ }
258
+ };
259
+ },
260
+ addCommands() {
261
+ return {
262
+ setAttachment: (e) => ({ chain: o }) => o().insertContent({ type: this.name, attrs: e }).run()
263
+ };
264
+ },
265
+ addNodeView() {
266
+ return E(ie);
267
+ }
268
+ });
6
269
  export {
7
- a as Attachment,
8
- e as RichTextAttachment
270
+ ne as Attachment,
271
+ we as RichTextAttachment
9
272
  };
@@ -1,5 +1,5 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./clsx-CXbNJWDD.cjs"),p=require("./jsx-runtime-C_NLcKys.cjs"),l=require("react/jsx-runtime"),a=require("./index-De9MZVWQ.cjs");require("react");require("./theme.cjs");var m=/^\s*>\s$/,g=c.Node3.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return p.h("blockquote",{...c.mergeAttributes(this.options.HTMLAttributes,t),children:p.h("slot",{})})},parseMarkdown:(t,e)=>e.createNode("blockquote",void 0,e.parseChildren(t.tokens||[])),renderMarkdown:(t,e)=>{if(!t.content)return"";const o=">",n=[];return t.content.forEach(i=>{const u=e.renderChildren([i]).split(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./clsx-CXbNJWDD.cjs"),d=require("./jsx-runtime-C_NLcKys.cjs"),l=require("react/jsx-runtime"),q=require("./toggle-C9tcMm1r.cjs"),p=require("./useButtonProps-D9ndBdmA.cjs");var m=/^\s*>\s$/,b=c.Node3.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return d.h("blockquote",{...c.mergeAttributes(this.options.HTMLAttributes,t),children:d.h("slot",{})})},parseMarkdown:(t,e)=>e.createNode("blockquote",void 0,e.parseChildren(t.tokens||[])),renderMarkdown:(t,e)=>{if(!t.content)return"";const o=">",n=[];return t.content.forEach(i=>{const u=e.renderChildren([i]).split(`
2
2
  `).map(r=>r.trim()===""?o:`${o} ${r}`);n.push(u.join(`
3
3
  `))}),n.join(`
4
4
  ${o}
5
- `)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[c.wrappingInputRule({find:m,type:this.type})]}});function b(){const t=a.useButtonProps(h.name),{icon:e=void 0,tooltip:o=void 0,shortcutKeys:n=void 0,tooltipOptions:i={},action:s=void 0,isActive:d=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:u,disabled:r,update:q}=a.useToggleActive(d),k=()=>{r||s&&(s(),q())};return t?l.jsx(a.ActionButton,{action:k,dataState:u,disabled:r,icon:e,shortcutKeys:n,tooltip:o,tooltipOptions:i}):l.jsx(l.Fragment,{})}const h=g.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),HTMLAttributes:{class:"blockquote"},button:({editor:e,t:o,extension:n})=>({componentProps:{action:()=>e.commands.toggleBlockquote(),isActive:()=>e.isActive("blockquote"),disabled:!e.can().toggleBlockquote(),icon:"TextQuote",shortcutKeys:n.options.shortcutKeys??["shift","mod","B"],tooltip:o("editor.blockquote.tooltip")}})}}});exports.Blockquote=h;exports.RichTextBlockquote=b;
5
+ `)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[c.wrappingInputRule({find:m,type:this.type})]}});function f(){const t=p.useButtonProps(h.name),{icon:e=void 0,tooltip:o=void 0,shortcutKeys:n=void 0,tooltipOptions:i={},action:s=void 0,isActive:a=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:u,disabled:r,update:g}=p.useToggleActive(a),k=()=>{r||s&&(s(),g())};return t?l.jsx(q.ActionButton,{action:k,dataState:u,disabled:r,icon:e,shortcutKeys:n,tooltip:o,tooltipOptions:i}):l.jsx(l.Fragment,{})}const h=b.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),HTMLAttributes:{class:"blockquote"},button:({editor:e,t:o,extension:n})=>({componentProps:{action:()=>e.commands.toggleBlockquote(),isActive:()=>e.isActive("blockquote"),disabled:!e.can().toggleBlockquote(),icon:"TextQuote",shortcutKeys:n.options.shortcutKeys??["shift","mod","B"],tooltip:o("editor.blockquote.tooltip")}})}}});exports.Blockquote=h;exports.RichTextBlockquote=f;
package/lib/Blockquote.js CHANGED
@@ -1,9 +1,8 @@
1
- import { N as m, w as h, m as k } from "./clsx-BUPZHhq3.js";
1
+ import { N as m, w as h, m as k } from "./clsx-m_C5j3RU.js";
2
2
  import { h as a } from "./jsx-runtime-CT7Pcg-t.js";
3
- import { jsx as d, Fragment as g } from "react/jsx-runtime";
4
- import { u as f, d as b, A as q } from "./index-B0d-u29p.js";
5
- import "react";
6
- import "./theme.js";
3
+ import { jsx as l, Fragment as f } from "react/jsx-runtime";
4
+ import { A as g } from "./toggle-CaSwYCk4.js";
5
+ import { u as b, c as q } from "./useButtonProps-D-ruygH7.js";
7
6
  var v = /^\s*>\s$/, B = m.create({
8
7
  name: "blockquote",
9
8
  addOptions() {
@@ -55,19 +54,19 @@ ${e}
55
54
  ];
56
55
  }
57
56
  });
58
- function H() {
59
- const t = f(A.name), {
57
+ function C() {
58
+ const t = b(A.name), {
60
59
  icon: o = void 0,
61
60
  tooltip: e = void 0,
62
61
  shortcutKeys: n = void 0,
63
62
  tooltipOptions: i = {},
64
63
  action: s = void 0,
65
64
  isActive: u = void 0
66
- } = (t == null ? void 0 : t.componentProps) ?? {}, { dataState: c, disabled: r, update: l } = b(u), p = () => {
67
- r || s && (s(), l());
65
+ } = (t == null ? void 0 : t.componentProps) ?? {}, { dataState: c, disabled: r, update: d } = q(u), p = () => {
66
+ r || s && (s(), d());
68
67
  };
69
- return t ? /* @__PURE__ */ d(
70
- q,
68
+ return t ? /* @__PURE__ */ l(
69
+ g,
71
70
  {
72
71
  action: p,
73
72
  dataState: c,
@@ -77,7 +76,7 @@ function H() {
77
76
  tooltip: e,
78
77
  tooltipOptions: i
79
78
  }
80
- ) : /* @__PURE__ */ d(g, {});
79
+ ) : /* @__PURE__ */ l(f, {});
81
80
  }
82
81
  const A = /* @__PURE__ */ B.extend({
83
82
  //@ts-expect-error
@@ -103,5 +102,5 @@ const A = /* @__PURE__ */ B.extend({
103
102
  });
104
103
  export {
105
104
  A as Blockquote,
106
- H as RichTextBlockquote
105
+ C as RichTextBlockquote
107
106
  };
package/lib/Bold.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./clsx-CXbNJWDD.cjs"),u=require("./jsx-runtime-C_NLcKys.cjs"),r=require("./index-De9MZVWQ.cjs"),i=require("react/jsx-runtime");require("react");require("./theme.cjs");var y=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,_=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,B=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,k=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,v=o.Mark.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return u.h("strong",{...o.mergeAttributes(this.options.HTMLAttributes,t),children:u.h("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[o.markInputRule({find:y,type:this.type}),o.markInputRule({find:B,type:this.type})]},addPasteRules(){return[o.markPasteRule({find:_,type:this.type}),o.markPasteRule({find:k,type:this.type})]}});function M(){const t=r.useButtonProps(l.name),{icon:e=void 0,tooltip:n=void 0,shortcutKeys:s=void 0,tooltipOptions:c={},action:a=void 0,isActive:p=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:g,disabled:d,update:m}=r.useToggleActive(p),h=()=>{d||a&&(a(),m())};return t?i.jsx(r.ActionButton,{action:h,dataState:g,disabled:d,icon:e,shortcutKeys:s,tooltip:n,tooltipOptions:c}):i.jsx(i.Fragment,{})}const l=v.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:n,extension:s})=>({component:r.ActionButton,componentProps:{action:()=>e.commands.toggleBold(),isActive:()=>e.isActive("bold"),icon:"Bold",shortcutKeys:s.options.shortcutKeys??["mod","B"],tooltip:n("editor.bold.tooltip")}})}}});exports.Bold=l;exports.RichTextBold=M;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./clsx-CXbNJWDD.cjs"),a=require("./jsx-runtime-C_NLcKys.cjs"),l=require("./toggle-C9tcMm1r.cjs"),s=require("react/jsx-runtime"),u=require("./useButtonProps-D9ndBdmA.cjs");var B=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,_=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,k=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,v=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,M=o.Mark.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return a.h("strong",{...o.mergeAttributes(this.options.HTMLAttributes,t),children:a.h("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[o.markInputRule({find:B,type:this.type}),o.markInputRule({find:k,type:this.type})]},addPasteRules(){return[o.markPasteRule({find:_,type:this.type}),o.markPasteRule({find:v,type:this.type})]}});function b(){const t=u.useButtonProps(c.name),{icon:e=void 0,tooltip:r=void 0,shortcutKeys:n=void 0,tooltipOptions:p={},action:i=void 0,isActive:g=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:m,disabled:d,update:h}=u.useToggleActive(g),y=()=>{d||i&&(i(),h())};return t?s.jsx(l.ActionButton,{action:y,dataState:m,disabled:d,icon:e,shortcutKeys:n,tooltip:r,tooltipOptions:p}):s.jsx(s.Fragment,{})}const c=M.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:r,extension:n})=>({component:l.ActionButton,componentProps:{action:()=>e.commands.toggleBold(),isActive:()=>e.isActive("bold"),icon:"Bold",shortcutKeys:n.options.shortcutKeys??["mod","B"],tooltip:r("editor.bold.tooltip")}})}}});exports.Bold=c;exports.RichTextBold=b;
package/lib/Bold.js CHANGED
@@ -1,9 +1,8 @@
1
- import { M as _, e as a, f as i, m as y } from "./clsx-BUPZHhq3.js";
1
+ import { M as _, e as a, f as i, m as f } from "./clsx-m_C5j3RU.js";
2
2
  import { h as d } from "./jsx-runtime-CT7Pcg-t.js";
3
- import { u as f, d as M, A as l } from "./index-B0d-u29p.js";
4
- import { jsx as u, Fragment as v } from "react/jsx-runtime";
5
- import "react";
6
- import "./theme.js";
3
+ import { A as l } from "./toggle-CaSwYCk4.js";
4
+ import { jsx as u, Fragment as y } from "react/jsx-runtime";
5
+ import { u as M, c as v } from "./useButtonProps-D-ruygH7.js";
7
6
  var B = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, k = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g, b = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/, A = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g, R = _.create({
8
7
  name: "bold",
9
8
  addOptions() {
@@ -31,7 +30,7 @@ var B = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, k = /(?:^|\s)(\*
31
30
  ];
32
31
  },
33
32
  renderHTML({ HTMLAttributes: t }) {
34
- return /* @__PURE__ */ d("strong", { ...y(this.options.HTMLAttributes, t), children: /* @__PURE__ */ d("slot", {}) });
33
+ return /* @__PURE__ */ d("strong", { ...f(this.options.HTMLAttributes, t), children: /* @__PURE__ */ d("slot", {}) });
35
34
  },
36
35
  markdownTokenName: "strong",
37
36
  parseMarkdown: (t, e) => e.applyMark("bold", e.parseInline(t.tokens || [])),
@@ -74,15 +73,15 @@ var B = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, k = /(?:^|\s)(\*
74
73
  ];
75
74
  }
76
75
  });
77
- function K() {
78
- const t = f(x.name), {
76
+ function H() {
77
+ const t = M(x.name), {
79
78
  icon: e = void 0,
80
79
  tooltip: o = void 0,
81
80
  shortcutKeys: r = void 0,
82
81
  tooltipOptions: p = {},
83
82
  action: n = void 0,
84
83
  isActive: m = void 0
85
- } = (t == null ? void 0 : t.componentProps) ?? {}, { dataState: c, disabled: s, update: g } = M(m), h = () => {
84
+ } = (t == null ? void 0 : t.componentProps) ?? {}, { dataState: c, disabled: s, update: g } = v(m), h = () => {
86
85
  s || n && (n(), g());
87
86
  };
88
87
  return t ? /* @__PURE__ */ u(
@@ -96,7 +95,7 @@ function K() {
96
95
  tooltip: o,
97
96
  tooltipOptions: p
98
97
  }
99
- ) : /* @__PURE__ */ u(v, {});
98
+ ) : /* @__PURE__ */ u(y, {});
100
99
  }
101
100
  const x = /* @__PURE__ */ R.extend({
102
101
  //@ts-expect-error
@@ -119,5 +118,5 @@ const x = /* @__PURE__ */ R.extend({
119
118
  });
120
119
  export {
121
120
  x as Bold,
122
- K as RichTextBold
121
+ H as RichTextBold
123
122
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./index-BCzvbrf5.cjs"),s=require("react/jsx-runtime"),n=require("./index-De9MZVWQ.cjs");require("react");require("./theme.cjs");function h(){const t=n.useButtonProps(l.name),{icon:e=void 0,tooltip:i=void 0,shortcutKeys:o=void 0,tooltipOptions:r={},action:c=void 0,isActive:d=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:a,disabled:u,update:p}=n.useToggleActive(d),m=()=>{u||c&&(c(),p())};return t?s.jsx(n.ActionButton,{action:m,dataState:a,disabled:u,icon:e,shortcutKeys:o,tooltip:i,tooltipOptions:r}):s.jsx(s.Fragment,{})}const l=v.BulletList.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:i,extension:o})=>({componentProps:{action:()=>e.commands.toggleBulletList(),isActive:()=>e.isActive("bulletList"),disabled:!1,shortcutKeys:o.options.shortcutKeys??["shift","mod","8"],icon:"List",tooltip:i("editor.bulletlist.tooltip")}})}}});exports.BulletList=l;exports.RichTextBulletList=h;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./index-BCzvbrf5.cjs"),s=require("react/jsx-runtime"),m=require("./toggle-C9tcMm1r.cjs"),u=require("./useButtonProps-D9ndBdmA.cjs");function B(){const t=u.useButtonProps(l.name),{icon:o=void 0,tooltip:e=void 0,shortcutKeys:i=void 0,tooltipOptions:r={},action:n=void 0,isActive:d=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:a,disabled:c,update:p}=u.useToggleActive(d),v=()=>{c||n&&(n(),p())};return t?s.jsx(m.ActionButton,{action:v,dataState:a,disabled:c,icon:o,shortcutKeys:i,tooltip:e,tooltipOptions:r}):s.jsx(s.Fragment,{})}const l=g.BulletList.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:o,t:e,extension:i})=>({componentProps:{action:()=>o.commands.toggleBulletList(),isActive:()=>o.isActive("bulletList"),disabled:!1,shortcutKeys:i.options.shortcutKeys??["shift","mod","8"],icon:"List",tooltip:e("editor.bulletlist.tooltip")}})}}});exports.BulletList=l;exports.RichTextBulletList=B;
package/lib/BulletList.js CHANGED
@@ -1,21 +1,20 @@
1
- import { B as d } from "./index-DZj2z9_1.js";
1
+ import { B as d } from "./index-s3l5RdyW.js";
2
2
  import { jsx as c, Fragment as m } from "react/jsx-runtime";
3
- import { u as f, d as v, A } from "./index-B0d-u29p.js";
4
- import "react";
5
- import "./theme.js";
6
- function y() {
7
- const t = f(B.name), {
3
+ import { A as f } from "./toggle-CaSwYCk4.js";
4
+ import { u as v, c as A } from "./useButtonProps-D-ruygH7.js";
5
+ function x() {
6
+ const t = v(B.name), {
8
7
  icon: o = void 0,
9
8
  tooltip: i = void 0,
10
9
  shortcutKeys: s = void 0,
11
10
  tooltipOptions: r = {},
12
11
  action: e = void 0,
13
12
  isActive: l = void 0
14
- } = (t == null ? void 0 : t.componentProps) ?? {}, { dataState: u, disabled: n, update: a } = v(l), p = () => {
13
+ } = (t == null ? void 0 : t.componentProps) ?? {}, { dataState: u, disabled: n, update: a } = A(l), p = () => {
15
14
  n || e && (e(), a());
16
15
  };
17
16
  return t ? /* @__PURE__ */ c(
18
- A,
17
+ f,
19
18
  {
20
19
  action: p,
21
20
  dataState: u,
@@ -49,5 +48,5 @@ const B = /* @__PURE__ */ d.extend({
49
48
  });
50
49
  export {
51
50
  B as BulletList,
52
- y as RichTextBulletList
51
+ x as RichTextBulletList
53
52
  };
package/lib/Callout.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./clsx-CXbNJWDD.cjs"),o=require("./index-De9MZVWQ.cjs"),t=require("react/jsx-runtime"),x=require("react");require("./theme.cjs");const c=require("lucide-react"),s=require("./select-DTNz0ZeE.cjs"),k=require("./index-DgOXAdKt.cjs"),j=[{value:"note",label:"Note",icon:c.Info,color:"#1f6feb",background:"#1f6feb1f"},{value:"tip",label:"Tip",icon:c.Lightbulb,color:"#238636",background:"#2386361f"},{value:"important",label:"Important",icon:c.AlertCircle,color:"#ab7df8",background:"#ab7df81f"},{value:"warning",label:"Warning",icon:c.TriangleAlert,color:"#d29922",background:"#d299221f"},{value:"caution",label:"Caution",icon:c.OctagonAlert,color:"#f85149",background:"#f851491f"}];function q({node:e}){const{type:l="note",title:r="",body:u=""}=e.attrs,d=(j.find(h=>h.value===l)||j[0]).icon;return t.jsx(a.NodeViewWrapper,{children:t.jsxs("div",{className:a.clsx("richtext-relative richtext-my-4 richtext-rounded-lg richtext-border richtext-p-4",{"richtext-bg-[#1f6feb1f] richtext-border-[#1f6feb]":l==="note","richtext-bg-[#2386361f] richtext-border-[#238636]":l==="tip","richtext-bg-[#ab7df81f] richtext-border-[#ab7df8]":l==="important","richtext-bg-[#d299221f] richtext-border-[#d29922]":l==="warning","richtext-bg-[#f851491f] richtext-border-[#f85149]":l==="caution"}),children:[t.jsxs("div",{className:a.clsx("richtext-mb-2 richtext-flex richtext-items-center richtext-gap-2",{"richtext-text-[#1f6feb]":l==="note","richtext-text-[#238636]":l==="tip","richtext-text-[#ab7df8]":l==="important","richtext-text-[#d29922]":l==="warning","richtext-text-[#f85149]":l==="caution"}),children:[t.jsx(d,{className:"richtext-size-5"}),t.jsx("span",{className:"richtext-font-semibold",children:r})]}),u&&t.jsx("p",{className:"richtext-pl-[28px]",children:u})]})})}const w=[{value:"note",label:"Note",icon:"Info"},{value:"tip",label:"Tip",icon:"Lightbulb"},{value:"important",label:"Important",icon:"AlertCircle"},{value:"warning",label:"Warning",icon:"TriangleAlert"},{value:"caution",label:"Caution",icon:"OctagonAlert"}];function M(){const{t:e}=k.useLocale(),l=o.useEditorInstance(),r=o.useButtonProps(C.name),[u,n]=x.useState(!1),[d,h]=x.useState("note"),[b,g]=x.useState(""),[f,v]=x.useState(""),{icon:y=void 0,tooltip:T=void 0,shortcutKeys:A=void 0,tooltipOptions:L={},isActive:N=void 0}=(r==null?void 0:r.componentProps)??{},{dataState:S,disabled:m}=o.useToggleActive(N),I=()=>{l&&(l.chain().focus().setCallout({type:d,title:b,body:f}).run(),n(!1),h("note"),g(""),v(""))},O=()=>{m||n(!0)};return r?t.jsxs(o.Dialog,{onOpenChange:n,open:u,children:[t.jsx(o.DialogTrigger,{asChild:!0,children:t.jsx(o.ActionButton,{action:O,dataState:S,disabled:m,icon:y,shortcutKeys:A,tooltip:T,tooltipOptions:L})}),t.jsxs(o.DialogContent,{children:[t.jsx(o.DialogTitle,{children:e("editor.callout.dialog.title")}),t.jsxs("div",{className:"richtext-space-y-4 richtext-py-4",children:[t.jsxs("div",{className:"richtext-space-y-2",children:[t.jsx(o.Label,{children:e("editor.callout.dialog.type")}),t.jsxs(s.Select,{onValueChange:h,value:d,children:[t.jsx(s.SelectTrigger,{children:t.jsx(s.SelectValue,{placeholder:e("editor.callout.dialog.type.placeholder")})}),t.jsx(s.SelectContent,{children:w.map(i=>t.jsx(s.SelectItem,{value:i.value,children:e(`editor.callout.type.${i.value}`)},i.value))})]})]}),t.jsxs("div",{className:"richtext-space-y-2",children:[t.jsx(o.Label,{children:e("editor.callout.dialog.title.label")}),t.jsx(o.Input,{onChange:i=>g(i.target.value),placeholder:e("editor.callout.dialog.title.placeholder"),value:b})]}),t.jsxs("div",{className:"richtext-space-y-2",children:[t.jsx(o.Label,{children:e("editor.callout.dialog.body.label")}),t.jsx(o.Input,{onChange:i=>v(i.target.value),placeholder:e("editor.callout.dialog.body.placeholder"),value:f})]})]}),t.jsxs(o.DialogFooter,{children:[t.jsx(o.Button,{onClick:()=>n(!1),variant:"outline",children:e("editor.callout.dialog.button.cancel")}),t.jsx(o.Button,{onClick:I,children:e("editor.callout.dialog.button.apply")})]})]})]}):t.jsx(t.Fragment,{})}function p(e){return l=>l.getAttribute(e)}const C=a.Node3.create({name:"callout",group:"block",selectable:!0,atom:!0,draggable:!0,inline:!1,addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),HTMLAttributes:{class:"callout"},button:({editor:l,t:r})=>({component:o.ActionButton,componentProps:{action:()=>!0,isActive:()=>l.isActive("callout"),disabled:!1,icon:"Callout",tooltip:r("editor.callout.tooltip")}})}},parseHTML(){return[{tag:"div.callout"}]},renderHTML({HTMLAttributes:e}){return["div",a.mergeAttributes(this.options&&this.options.HTMLAttributes||{},e)]},addAttributes(){return{type:{default:"",parseHTML:p("type")},title:{default:"",parseHTML:p("title")},body:{default:"",parseHTML:p("body")}}},addCommands(){return{setCallout:e=>({chain:l})=>l().insertContent({type:this.name,attrs:e}).run()}},addNodeView(){return a.ReactNodeViewRenderer(q)}});exports.Callout=C;exports.RichTextCallout=M;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./clsx-CXbNJWDD.cjs"),L=require("./toggle-C9tcMm1r.cjs"),t=require("react/jsx-runtime"),n=require("lucide-react"),x=require("react"),c=require("./dialog-C8J59d2J.cjs"),s=require("./select-B8HIWDXf.cjs"),p=require("./useButtonProps-D9ndBdmA.cjs"),H=require("./index-DgOXAdKt.cjs"),b=require("./label-BgIVynq3.cjs"),y=require("./input-DwLo4r7V.cjs"),T=require("./button-B4Sz2ZhW.cjs"),A=[{value:"note",label:"Note",icon:n.Info,color:"#1f6feb",background:"#1f6feb1f"},{value:"tip",label:"Tip",icon:n.Lightbulb,color:"#238636",background:"#2386361f"},{value:"important",label:"Important",icon:n.AlertCircle,color:"#ab7df8",background:"#ab7df81f"},{value:"warning",label:"Warning",icon:n.TriangleAlert,color:"#d29922",background:"#d299221f"},{value:"caution",label:"Caution",icon:n.OctagonAlert,color:"#f85149",background:"#f851491f"}];function R({node:e}){const{type:l="note",title:o="",body:u=""}=e.attrs,d=(A.find(h=>h.value===l)||A[0]).icon;return t.jsx(i.NodeViewWrapper,{children:t.jsxs("div",{className:i.clsx("richtext-relative richtext-my-4 richtext-rounded-lg richtext-border richtext-p-4",{"richtext-bg-[#1f6feb1f] richtext-border-[#1f6feb]":l==="note","richtext-bg-[#2386361f] richtext-border-[#238636]":l==="tip","richtext-bg-[#ab7df81f] richtext-border-[#ab7df8]":l==="important","richtext-bg-[#d299221f] richtext-border-[#d29922]":l==="warning","richtext-bg-[#f851491f] richtext-border-[#f85149]":l==="caution"}),children:[t.jsxs("div",{className:i.clsx("richtext-mb-2 richtext-flex richtext-items-center richtext-gap-2",{"richtext-text-[#1f6feb]":l==="note","richtext-text-[#238636]":l==="tip","richtext-text-[#ab7df8]":l==="important","richtext-text-[#d29922]":l==="warning","richtext-text-[#f85149]":l==="caution"}),children:[t.jsx(d,{className:"richtext-size-5"}),t.jsx("span",{className:"richtext-font-semibold",children:o})]}),u&&t.jsx("p",{className:"richtext-pl-[28px]",children:u})]})})}const D=[{value:"note",label:"Note",icon:"Info"},{value:"tip",label:"Tip",icon:"Lightbulb"},{value:"important",label:"Important",icon:"AlertCircle"},{value:"warning",label:"Warning",icon:"TriangleAlert"},{value:"caution",label:"Caution",icon:"OctagonAlert"}];function P(){const{t:e}=H.useLocale(),l=p.useEditorInstance(),o=p.useButtonProps(N.name),[u,a]=x.useState(!1),[d,h]=x.useState("note"),[f,v]=x.useState(""),[m,j]=x.useState(""),{icon:S=void 0,tooltip:q=void 0,shortcutKeys:I=void 0,tooltipOptions:O={},isActive:k=void 0}=(o==null?void 0:o.componentProps)??{},{dataState:w,disabled:C}=p.useToggleActive(k),B=()=>{l&&(l.chain().focus().setCallout({type:d,title:f,body:m}).run(),a(!1),h("note"),v(""),j(""))},M=()=>{C||a(!0)};return o?t.jsxs(c.Dialog,{onOpenChange:a,open:u,children:[t.jsx(c.DialogTrigger,{asChild:!0,children:t.jsx(L.ActionButton,{action:M,dataState:w,disabled:C,icon:S,shortcutKeys:I,tooltip:q,tooltipOptions:O})}),t.jsxs(c.DialogContent,{children:[t.jsx(c.DialogTitle,{children:e("editor.callout.dialog.title")}),t.jsxs("div",{className:"richtext-space-y-4 richtext-py-4",children:[t.jsxs("div",{className:"richtext-space-y-2",children:[t.jsx(b.Label,{children:e("editor.callout.dialog.type")}),t.jsxs(s.Select,{onValueChange:h,value:d,children:[t.jsx(s.SelectTrigger,{children:t.jsx(s.SelectValue,{placeholder:e("editor.callout.dialog.type.placeholder")})}),t.jsx(s.SelectContent,{children:D.map(r=>t.jsx(s.SelectItem,{value:r.value,children:e(`editor.callout.type.${r.value}`)},r.value))})]})]}),t.jsxs("div",{className:"richtext-space-y-2",children:[t.jsx(b.Label,{children:e("editor.callout.dialog.title.label")}),t.jsx(y.Input,{onChange:r=>v(r.target.value),placeholder:e("editor.callout.dialog.title.placeholder"),value:f})]}),t.jsxs("div",{className:"richtext-space-y-2",children:[t.jsx(b.Label,{children:e("editor.callout.dialog.body.label")}),t.jsx(y.Input,{onChange:r=>j(r.target.value),placeholder:e("editor.callout.dialog.body.placeholder"),value:m})]})]}),t.jsxs(c.DialogFooter,{children:[t.jsx(T.Button,{onClick:()=>a(!1),variant:"outline",children:e("editor.callout.dialog.button.cancel")}),t.jsx(T.Button,{onClick:B,children:e("editor.callout.dialog.button.apply")})]})]})]}):t.jsx(t.Fragment,{})}function g(e){return l=>l.getAttribute(e)}const N=i.Node3.create({name:"callout",group:"block",selectable:!0,atom:!0,draggable:!0,inline:!1,addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),HTMLAttributes:{class:"callout"},button:({editor:l,t:o})=>({component:L.ActionButton,componentProps:{action:()=>!0,isActive:()=>l.isActive("callout"),disabled:!1,icon:"Callout",tooltip:o("editor.callout.tooltip")}})}},parseHTML(){return[{tag:"div.callout"}]},renderHTML({HTMLAttributes:e}){return["div",i.mergeAttributes(this.options&&this.options.HTMLAttributes||{},e)]},addAttributes(){return{type:{default:"",parseHTML:g("type")},title:{default:"",parseHTML:g("title")},body:{default:"",parseHTML:g("body")}}},addCommands(){return{setCallout:e=>({chain:l})=>l().insertContent({type:this.name,attrs:e}).run()}},addNodeView(){return i.ReactNodeViewRenderer(R)}});exports.Callout=N;exports.RichTextCallout=P;